<?php
require 'user.php';
require 'function.php';
if((is_dir($path=_decode($_GET['path']))==false)) {
header('Content-Type: text/html; charset=UTF-8');
echo <<<HTML
Error：404
HTML;
exit;
}
header('Content-Type: text/html; charset=UTF-8');
echo <<<HTML
<html>
<head>
<title>文件管理－SVN检出</title>
<style type="text/css">
.big_board{background-color:#009BCE;color:#FFF;}
.board_title{margin-bottom:1px;border:1px solid #09F;}
</style>
</head>
<body>
<div class="big_board"><div class="board_title">爱特文管－路径信息</div></div>
HTML;
echo '<a href="index.php?path='.$_GET['path'].'">'.realpath($path).'</a>';
if($_POST['go']!=null) {
echo <<<HTML
<div class="big_board"><div class="board_title">爱特文管－系统提示</div></div>
HTML;
$url=escapeshellarg($_SESSION['svnurl']=$_POST['url']);
$user=escapeshellarg("--username=".($_SESSION['user']=$_POST['user']));
$pass=escapeshellarg("--password=".($_SESSION['pass']=$_POST['pass']));
$pth=escapeshellarg(svnpath($path));
$cmd="svn checkout $url $pth $_POST[f] ".($_SESSION['key']="$user $pass --non-interactive");
echo htmlcode(cmd($cmd));


}else{
echo <<<HTML
<div class="big_board"><div class="board_title">爱特文管－SVN信息</div></div>
HTML;
echo '<form action="'.$_SERVER['PHP_SELF'].'?path='.$_GET['path'].'" method="post">';
echo '检出URL: <input type="text" name="url" value="'.htmlspecialchars($_SESSION['svnurl']).'"/><br/>（如果要检出指定版本，可以通过URL@REV格式指定。默认检出最新版本）<br/>';
echo '用户名: <input name="user" value="'.htmlspecialchars($_SESSION['user']).'"/><br/>';
echo '密&nbsp;&nbsp;码: <input type="password" name="pass" value="'.htmlspecialchars($_SESSION['pass']).'"/><br/>';
echo '<input type="submit" name="go" value="检出"/><input type="checkbox" name="f" value="--force"/>强制操作<br/>（可能会连接超时。如果超时，<a href="status.php?path='.$_GET['path'].'&amp;onlyshow=1">点击这里查看检出结果</a>）';
echo '</form>';}
echo <<<HTML
<div class="big_board"><div class="board_title">By：Admin@Lspecial.Com</div></div>
</body>
</html>
HTML;
?>